package com.learn.model;

public class Subject {
    private String subjectName;
    private String subjectNo;
    private int subjectLife;

    public Student[] getStudents() {
        if(this.students==null){
            this.students = new Student[200];
        }
        return students;
    }

    public void setStudents(Student[] students) {
        this.students = students;
    }

    private Student[] students;
    // 构造方法
    public Subject(){

    }

    public Subject(String subjectName, String subjectNo, int subjectLife) {
        this.subjectName = subjectName;
        this.subjectNo = subjectNo;
        this.setSubjectLife(subjectLife);
    }

    public void setSubjectName(String subjectName){
        this.subjectName = subjectName;
    }

    public void setSubjectNo(String subjectNo){
        this.subjectNo = subjectNo;
    }

    public void setSubjectLife(int subjectLife){
        if(subjectLife <= 0){
            return;
        }
        this.subjectLife = subjectLife;
    }

    public String getSubjectName() {
        return subjectName;
    }

    public String getSubjectNo() {
        return subjectNo;
    }

    public int getSubjectLife() {
        return subjectLife;
    }

    /*
        @return 返回专业相关信息
     */
    public String info(){
        String str = "";
        str = "专业名词："+ this.getSubjectName() + "，专业编号；" + this.subjectNo;
        return str;
    }
    public static void main(String[] args) {

    }
}
